package com.ruoyi.project.sms.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.sms.mapper.SmsCouponUserMapper;
import com.ruoyi.db.sms.domain.SmsCouponUser;
import com.ruoyi.db.sms.domain.query.SmsCouponUserQueryVo;

/**
 * 优惠券用户关联Service业务层处理
 *
 * @author yfy
 * @date 2020-04-26
 */
@Service
public class SmsCouponUserService
{
    @Autowired
    private SmsCouponUserMapper smsCouponUserMapper;

    /**
     * 查询优惠券用户关联
     *
     * @param id 优惠券用户关联ID
     * @return 优惠券用户关联
     */
    public SmsCouponUser selectSmsCouponUserById(Long id)
    {
        return smsCouponUserMapper.selectSmsCouponUserById(id);
    }

    /**
     * 查询优惠券用户关联列表
     *
     * @param smsCouponUserQueryVo 优惠券用户关联查询参数
     * @return 优惠券用户关联
     */
    public List<SmsCouponUser> selectSmsCouponUserList(SmsCouponUserQueryVo smsCouponUserQueryVo)
    {
        return smsCouponUserMapper.selectSmsCouponUserList(smsCouponUserQueryVo);
    }

    /**
     * 新增优惠券用户关联
     *
     * @param smsCouponUser 优惠券用户关联
     * @return 结果
     */
    public int insertSmsCouponUser(SmsCouponUser smsCouponUser)
    {
        return smsCouponUserMapper.insertSmsCouponUser(smsCouponUser);
    }

    /**
     * 修改优惠券用户关联
     *
     * @param smsCouponUser 优惠券用户关联
     * @return 结果
     */
    public int updateSmsCouponUser(SmsCouponUser smsCouponUser)
    {
        smsCouponUser.setUpdateTime(LocalDateTime.now());
        return smsCouponUserMapper.updateSmsCouponUser(smsCouponUser);
    }

    /**
     * 批量删除优惠券用户关联
     *
     * @param ids 需要删除的优惠券用户关联ID
     * @return 结果
     */
    public int deleteSmsCouponUserByIds(Long[] ids)
    {
        return smsCouponUserMapper.deleteSmsCouponUserByIds(ids);
    }

    /**
     * 删除优惠券用户关联信息
     *
     * @param id 优惠券用户关联ID
     * @return 结果
     */
    public int deleteSmsCouponUserById(Long id)
    {
        return smsCouponUserMapper.deleteSmsCouponUserById(id);
    }
}
